package com.naver.xml.kxml;

import java.io.File;
import java.io.FileReader;
import java.io.Reader;

import org.kxml2.io.KXmlParser;
import org.kxml2.io.KXmlSerializer;
import org.kxml2.kdom.Document;
import org.kxml2.kdom.Element;
import org.kxml2.kdom.Node;
import org.xmlpull.v1.XmlPullParser;

public class KxmlRef {
	KXmlSerializer kXmlSerializer;

	public KxmlRef() {
		
	}
	
	public static void main(String[] args) throws Exception {
		KXmlParser parser = new KXmlParser();
		Reader reader = new FileReader(new File("D:\\dev\\osm\\source\\asia.osm\\asia.osm"));
		parser.setInput(reader);
		parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
		Document doc = new Document();
		doc.parse(parser);
		
		Element element = doc.getElement(1);
//		System.out.println(element.getChildCount());
		
		for (int i = 0; i < 100; i++) {
			Object child = element.getChild(i);
			if (child instanceof String) {
				continue;
			} else if (child instanceof Element){
				Element e = (Element)child;
				System.out.println(e.getName());
			}
		}
	}
}
